Your task has been delegated.
Process is 
<div id="threadStatus">
<?php 
if($listener->isRunning($threadId))
{
	echo "Working in background..";
}
else
{
	echo "finished already before this page opened..";
}
?>
</div>

<script>
$(document).bind('threadComplete', function(){
	console.log("thread finished");
	$('#threadStatus').html("Finished.. Cool? ha?");
});
</script>